package patterns.iterator;

/**
 * Created by lenovo on 2016/11/30 0030.
 * 使用NameRepository来获取迭代器，并打印输出names
 */
public class IteratorPatternDemo {
    public static void main(String[] args) {
        NameRepository names = new NameRepository();

        for (IIterator iterator = names.getIterator(); iterator.hasNext(); ) {
            System.out.println("Name: " + iterator.next().toString());
        }
    }
}
